package com.yidu.BusinessData.mapper;



import com.yidu.BusinessData.entity.Fund;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface FundMapper {
    /**
     * 增加基金信息
     * @param fund
     * @return int
     */
    @Insert("insert into fund values(#{fundId},#{fundName},#{fundFirstTime},#{fundType},#{fundTrustee},#{fundManager},#{firstFund},#{fundScale},#{custodianCost},#{bankCost},#{fundDay},#{fundBeiZhu})")
    public  int insertFund(Fund fund);
    /**
     * 修改基金信息
     * @param fund
     * @return
     */
    @Update("update fund set fundId=#{fundId},fundName=#{fundName},fundFirstTime=#{fundFirstTime},fundType=#{fundType},fundTrustee=#{fundTrustee},fundManager=#{fundManager},firstFund=#{firstFund},fundScale=#{fundScale},custodianCost=#{custodianCost},totalMoney=#{totalMoney},realityMoney=#{realityMoney},businessState=#{businessState} where TAId=#{TAId}")
    public int updateTABusiness(Fund fund);
    /**
     * 删除基金信息
     * @param TAId
     * @return
     */
    @Delete("delete from fund where fundId=#{TAId}")
    public int deleteTABusiness(String TAId);


    /**
     * 按条件查询加分页
     * @param fundMap 查询的条件  页码 每页显示的行数
     * @return 返回基金的集合
     *  ${strWhere} =“   and userName  like '%admin%' and roleId =1 ”
     */
    @Select("select * from fund where 1=1  ${strWhere} limit #{start},#{pageRows}")
    public List<Fund> selectFund(Map fundMap);

    @Select("select count(*) from fund where 1=1  ${strWhere}")
    public int Fundtotal(Map fundMap);
}
